import requests


class HttpRequests:
    def __init__(self, token=None):
        self.host = 'https://litemall.hogwarts.ceshiren.com'
        self.headers = {'X-Litemall-Token': token}

    def get(self, url, params=None, data=None):
        url = self.host + url
        r = requests.get(url, headers=self.headers, params=params, json=data, verify=False)
        if r.status_code == 200:
            return r.json()

    def post(self, url, params=None, data=None):
        url = self.host + url
        r = requests.post(url, headers=self.headers, params=params, json=data, verify=False)
        if r.status_code == 200:
            return r.json()
